<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>File Source for BuanViewHelperI18n.php</title>
	<link rel="stylesheet" type="text/css" href="../media/style.css">
	<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
	<td class="header-top-left"><img src="../media/logo.png" border="0" alt="phpDocumentor " /></td>
    <td class="header-top-right">Buan<br /><div class="header-top-right-subpackage">ViewHelper</div></td>
  </tr>
  <tr><td colspan="2" class="header-line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td colspan="2" class="header-menu">
      
                        
                      		[ <a href="../classtrees_Buan.html" class="menu">class tree: Buan</a> ]
		[ <a href="../elementindex_Buan.html" class="menu">index: Buan</a> ]
            [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td colspan="2" class="header-line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="195" class="menu">
		<div class="package-title">Buan</div>
  <div class="package">
	<div id="todolist">
			<p><a href="../todolist.html">Todo List</a></p>
	</div>
	</div>
      <b>Packages:</b><br />
  <div class="package">
              <a href="../li_Buan.html">Buan</a><br />
      	</div>
      <br />
                        <br />
                      </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<h1 align="center">Source for file BuanViewHelperI18n.php</h1>
<p>Documentation is available at <a href="../Buan/ViewHelper/_view-helper---BuanViewHelperI18n.php.html">BuanViewHelperI18n.php</a></p>
<div class="src-code"><span class="php">
<ol><li><div class="src-line"><a name="a1"></a><span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line"><a name="a2"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a3"></a><span class="src-doc">*&nbsp;Enables&nbsp;specified&nbsp;strings&nbsp;within&nbsp;a&nbsp;View's&nbsp;buffer&nbsp;to&nbsp;be&nbsp;translated&nbsp;to&nbsp;any&nbsp;other</span></div></li>
<li><div class="src-line"><a name="a4"></a><span class="src-doc">*&nbsp;language.</span></div></li>
<li><div class="src-line"><a name="a5"></a><span class="src-doc">*</span></div></li>
<li><div class="src-line"><a name="a6"></a><span class="src-doc">*&nbsp;Example&nbsp;usage&nbsp;(from&nbsp;within&nbsp;your&nbsp;custom&nbsp;View&nbsp;class'&nbsp;constructor):</span></div></li>
<li><div class="src-line"><a name="a7"></a><span class="src-doc">*&nbsp;&lt;code&gt;</span></div></li>
<li><div class="src-line"><a name="a8"></a><span class="src-doc">*&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;i18n&nbsp;=&nbsp;new&nbsp;Buan\ViewHelper\I18n($this);</span></div></li>
<li><div class="src-line"><a name="a9"></a><span class="src-doc">*&nbsp;&lt;/code&gt;</span></div></li>
<li><div class="src-line"><a name="a10"></a><span class="src-doc">*</span></div></li>
<li><div class="src-line"><a name="a11"></a><span class="src-doc">*&nbsp;</span><span class="src-doc-coretag">@package</span><span class="src-doc">&nbsp;Buan</span></div></li>
<li><div class="src-line"><a name="a12"></a><span class="src-doc">*&nbsp;</span><span class="src-doc-coretag">@subpackage</span><span class="src-doc">&nbsp;ViewHelper</span></div></li>
<li><div class="src-line"><a name="a13"></a><span class="src-doc">*/</span></div></li>
<li><div class="src-line"><a name="a14"></a>namespace&nbsp;<span class="src-id">Buan</span>\<span class="src-id">ViewHelper</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a15"></a><span class="src-key">class&nbsp;</span><a href="../Buan/ViewHelper/I18n.html">I18n</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a16"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a17"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a18"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;The&nbsp;default&nbsp;language&nbsp;code.</span></div></li>
<li><div class="src-line"><a name="a19"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a20"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">string&nbsp;</span></div></li>
<li><div class="src-line"><a name="a21"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a22"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">const&nbsp;</span><span class="src-id">DEFAULT_LANG&nbsp;</span>=&nbsp;<span class="src-str">'en'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a23"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a24"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a25"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;List&nbsp;of&nbsp;folders&nbsp;that&nbsp;contain&nbsp;dictionary&nbsp;files.</span></div></li>
<li><div class="src-line"><a name="a26"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a27"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">array&nbsp;</span></div></li>
<li><div class="src-line"><a name="a28"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a29"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><a href="../Buan/ViewHelper/I18n.html#var$dictionaryFolders">$dictionaryFolders</a>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a30"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a31"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a32"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;The&nbsp;language&nbsp;to&nbsp;use&nbsp;for&nbsp;all&nbsp;translations&nbsp;in&nbsp;the&nbsp;View&nbsp;attached&nbsp;to&nbsp;this</span></div></li>
<li><div class="src-line"><a name="a33"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;helper.</span></div></li>
<li><div class="src-line"><a name="a34"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a35"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">string&nbsp;</span></div></li>
<li><div class="src-line"><a name="a36"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a37"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><a href="../Buan/ViewHelper/I18n.html#var$language">$language</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a38"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a39"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a40"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;The&nbsp;View&nbsp;instance&nbsp;to&nbsp;which&nbsp;this&nbsp;helper&nbsp;is&nbsp;attached.</span></div></li>
<li><div class="src-line"><a name="a41"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a42"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">Buan\View&nbsp;</span></div></li>
<li><div class="src-line"><a name="a43"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a44"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><a href="../Buan/ViewHelper/I18n.html#var$view">$view</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a45"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a46"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a47"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Constructor</span></div></li>
<li><div class="src-line"><a name="a48"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a49"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">Buan\View&nbsp;</span><span class="src-doc">The&nbsp;View&nbsp;to&nbsp;which&nbsp;this&nbsp;helper&nbsp;is&nbsp;being&nbsp;attached</span></div></li>
<li><div class="src-line"><a name="a50"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">Buan\ViewHelper\I18n&nbsp;</span></div></li>
<li><div class="src-line"><a name="a51"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a52"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../Buan/ViewHelper/I18n.html#method__construct">__construct</a><span class="src-sym">(</span><span class="src-var">$view</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a53"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a54"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Set&nbsp;some&nbsp;defaults</span></div></li>
<li><div class="src-line"><a name="a55"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../Buan/ViewHelper/I18n.html#var$language">language</a>&nbsp;=&nbsp;<span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">DEFAULT_LANG</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a56"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a57"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Add&nbsp;&quot;onrender&quot;&nbsp;event&nbsp;to&nbsp;View</span></div></li>
<li><div class="src-line"><a name="a58"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../Buan/ViewHelper/I18n.html#var$view">view</a>&nbsp;=&nbsp;<span class="src-var">$view</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a59"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../Buan/ViewHelper/I18n.html#var$view">view</a><span class="src-sym">-&gt;</span><span class="src-id">addEventListener</span><span class="src-sym">(</span><span class="src-str">'onrender'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">,&nbsp;</span><span class="src-str">'translateView'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a60"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a61"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a62"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a63"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Add&nbsp;translation&nbsp;dictionary&nbsp;folder.&nbsp;This&nbsp;folder&nbsp;must&nbsp;contain&nbsp;a&nbsp;file&nbsp;for</span></div></li>
<li><div class="src-line"><a name="a64"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;each&nbsp;language&nbsp;you&nbsp;want&nbsp;to&nbsp;,&nbsp;ie.&nbsp;&quot;en.php&quot;,&nbsp;&quot;es.php&quot;,&nbsp;etc.</span></div></li>
<li><div class="src-line"><a name="a65"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a66"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Each&nbsp;of&nbsp;these&nbsp;files&nbsp;must&nbsp;return&nbsp;an&nbsp;array&nbsp;of&nbsp;source=&gt;translation&nbsp;entries,&nbsp;for</span></div></li>
<li><div class="src-line"><a name="a67"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;example:</span></div></li>
<li><div class="src-line"><a name="a68"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&lt;code&gt;</span></div></li>
<li><div class="src-line"><a name="a69"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;es.php</span></div></li>
<li><div class="src-line"><a name="a70"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;array&nbsp;(</span></div></li>
<li><div class="src-line"><a name="a71"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'hello'=&gt;'ola',</span></div></li>
<li><div class="src-line"><a name="a72"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'goodbye,&nbsp;%s'=&gt;'adios,&nbsp;%s'</span></div></li>
<li><div class="src-line"><a name="a73"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;);</span></div></li>
<li><div class="src-line"><a name="a74"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&lt;/code&gt;</span></div></li>
<li><div class="src-line"><a name="a75"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a76"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">Absolute&nbsp;folder&nbsp;path</span></div></li>
<li><div class="src-line"><a name="a77"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">void&nbsp;</span></div></li>
<li><div class="src-line"><a name="a78"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a79"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../Buan/ViewHelper/I18n.html#methodaddDictionaryFolder">addDictionaryFolder</a><span class="src-sym">(</span><span class="src-var">$src</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a80"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$src</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a81"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../Buan/ViewHelper/I18n.html#var$dictionaryFolders">dictionaryFolders</a>&nbsp;=&nbsp;<a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../Buan/ViewHelper/I18n.html#var$dictionaryFolders">dictionaryFolders</a><span class="src-sym">,&nbsp;</span><span class="src-var">$src</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a82"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a83"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a84"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../Buan/ViewHelper/I18n.html#var$dictionaryFolders">dictionaryFolders</a><span class="src-sym">[</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$src</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a85"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a86"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a87"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a88"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a89"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Return&nbsp;the&nbsp;currently&nbsp;set&nbsp;language&nbsp;code.</span></div></li>
<li><div class="src-line"><a name="a90"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a91"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">string&nbsp;</span></div></li>
<li><div class="src-line"><a name="a92"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a93"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../Buan/ViewHelper/I18n.html#methodgetLanguage">getLanguage</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a94"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../Buan/ViewHelper/I18n.html#var$language">language</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a95"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a96"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a97"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a98"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Set&nbsp;the&nbsp;language&nbsp;to&nbsp;which&nbsp;$this-&gt;view&nbsp;will&nbsp;be&nbsp;translated.</span></div></li>
<li><div class="src-line"><a name="a99"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a100"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;$code&nbsp;can&nbsp;be&nbsp;any&nbsp;string&nbsp;you&nbsp;want,&nbsp;but&nbsp;it&nbsp;may&nbsp;be&nbsp;good&nbsp;advice&nbsp;to&nbsp;follow&nbsp;the</span></div></li>
<li><div class="src-line"><a name="a101"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;ISO&nbsp;standards&nbsp;for&nbsp;language&nbsp;codes.</span></div></li>
<li><div class="src-line"><a name="a102"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a103"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc">Language&nbsp;code</span></div></li>
<li><div class="src-line"><a name="a104"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">void&nbsp;</span></div></li>
<li><div class="src-line"><a name="a105"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a106"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../Buan/ViewHelper/I18n.html#methodsetLanguage">setLanguage</a><span class="src-sym">(</span><span class="src-var">$code</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a107"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../Buan/ViewHelper/I18n.html#var$language">language</a>&nbsp;=&nbsp;<span class="src-var">$code</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a108"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a109"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a110"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a111"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Translates&nbsp;all&nbsp;[t:...]&nbsp;strings&nbsp;in&nbsp;$this-&gt;view's&nbsp;buffer&nbsp;to&nbsp;the&nbsp;language</span></div></li>
<li><div class="src-line"><a name="a112"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;specified&nbsp;by&nbsp;$this-&gt;language.&nbsp;The&nbsp;dictionary&nbsp;for&nbsp;this&nbsp;language&nbsp;will&nbsp;be</span></div></li>
<li><div class="src-line"><a name="a113"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;searched&nbsp;for&nbsp;in&nbsp;the&nbsp;list&nbsp;of&nbsp;$this-&gt;dictionaryFolders.</span></div></li>
<li><div class="src-line"><a name="a114"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a115"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Examples&nbsp;of&nbsp;strings&nbsp;and&nbsp;their&nbsp;conversions:</span></div></li>
<li><div class="src-line"><a name="a116"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&lt;code&gt;</span></div></li>
<li><div class="src-line"><a name="a117"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;[t:Hello]&nbsp;...&nbsp;Hello</span></div></li>
<li><div class="src-line"><a name="a118"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;[t:Dave:Hello,&nbsp;%s]&nbsp;...&nbsp;Hello,&nbsp;Dave</span></div></li>
<li><div class="src-line"><a name="a119"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;[t:Foo:Bar:I'm&nbsp;%s,&nbsp;and&nbsp;you're&nbsp;%s]&nbsp;...&nbsp;I'm&nbsp;Foo,&nbsp;and&nbsp;you're&nbsp;Bar</span></div></li>
<li><div class="src-line"><a name="a120"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;[t:See\:&nbsp;www.thundermonkey.net]&nbsp;...&nbsp;See:&nbsp;www.thundermonkey.net</span></div></li>
<li><div class="src-line"><a name="a121"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&lt;/code&gt;</span></div></li>
<li><div class="src-line"><a name="a122"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a123"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">void&nbsp;</span></div></li>
<li><div class="src-line"><a name="a124"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a125"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../Buan/ViewHelper/I18n.html#methodtranslateView">translateView</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a126"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a127"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Determine&nbsp;if&nbsp;there&nbsp;are&nbsp;any&nbsp;strings&nbsp;to&nbsp;be&nbsp;translated&nbsp;in&nbsp;$source</span></div></li>
<li><div class="src-line"><a name="a128"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$source&nbsp;</span>=<span class="src-sym">&amp;&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../Buan/ViewHelper/I18n.html#var$view">view</a><span class="src-sym">-&gt;</span><span class="src-id">buffer</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a129"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/preg_match_all">preg_match_all</a><span class="src-sym">(</span><span class="src-str">&quot;/\[t:([^\]]+)\]/ims&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-var">$source</span><span class="src-sym">,&nbsp;</span><span class="src-var">$matches</span><span class="src-sym">)</span>&gt;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a130"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a131"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Load&nbsp;global&nbsp;dictionary</span></div></li>
<li><div class="src-line"><a name="a132"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$dictionary&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a133"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../Buan/ViewHelper/I18n.html#var$dictionaryFolders">dictionaryFolders</a>&nbsp;<span class="src-key">as&nbsp;</span><span class="src-var">$dict</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a134"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$file&nbsp;</span>=&nbsp;<span class="src-str">&quot;</span>{<span class="src-var">$dict<span class="src-str"></span><span class="src-sym">}</span>/{<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../Buan/ViewHelper/I18n.html#var$language">language</a><span class="src-sym">}</span>.php<span class="src-str"><span class="src-str">"</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a135"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-id">is_file</span><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">))</span>&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a136"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-id">is_file</span><span class="src-sym">(</span><span class="src-str">"</span></span>{<span class="src-var">$dict<span class="src-str"></span><span class="src-sym">}</span>/<span class="src-str">"</span>.<span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">DEFAULT_LANG</span>.<span class="src-str">&quot;.php&quot;</span><span class="src-sym">))</span>&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a137"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">continue</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a138"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a139"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$file</span>&nbsp;=&nbsp;<span class="src-str">"</span></span>{<span class="src-var">$dict<span class="src-str"></span><span class="src-sym">}</span>/<span class="src-str">"</span>.<span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">DEFAULT_LANG</span>.<span class="src-str">&quot;.php&quot;</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a140"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a141"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$dictionary</span>&nbsp;=&nbsp;<span class="src-id">array_merge</span><span class="src-sym">(</span><span class="src-var">$dictionary</span><span class="src-sym">,</span>&nbsp;<span class="src-inc">include</span><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">))</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a142"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a143"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a144"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Replace&nbsp;all&nbsp;[t:*]&nbsp;placeholders&nbsp;in&nbsp;the&nbsp;$this-&gt;view's&nbsp;buffer.</span></span></div></li>
<li><div class="src-line"><a name="a145"></a><span class="src-str"><span class="src-comm"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;a&nbsp;string&nbsp;cannot&nbsp;be&nbsp;translated,&nbsp;then&nbsp;it&nbsp;is&nbsp;unaltered.</span></span></div></li>
<li><div class="src-line"><a name="a146"></a><span class="src-str"><span class="src-comm"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$delim</span>&nbsp;=&nbsp;<span class="src-str">&quot;[[[SPLIT]]]&quot;</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a147"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$tags</span>&nbsp;=&nbsp;<span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a148"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$translations</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a149"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$missing</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a150"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$matches</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span>&nbsp;<span class="src-key">as</span>&nbsp;<span class="src-var">$match</span><span class="src-sym">)</span>&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a151"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$params</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a152"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-id">strpos</span><span class="src-sym">(</span><span class="src-var">$match</span><span class="src-sym">,</span>&nbsp;<span class="src-str">&quot;:&quot;</span><span class="src-sym">)</span>!==<span class="src-id">FALSE</span><span class="src-sym">)</span>&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a153"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$match</span>&nbsp;=&nbsp;<span class="src-id">preg_replace</span><span class="src-sym">(</span><span class="src-str">&quot;/([^\\\\]):/&quot;</span><span class="src-sym">,</span>&nbsp;<span class="src-str">"</span>$1</span>{<span class="src-var">$delim<span class="src-str"></span><span class="src-sym">}</span><span class="src-str">"</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$match</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a154"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$match</span>&nbsp;=&nbsp;<span class="src-id">str_replace</span><span class="src-sym">(</span><span class="src-str">'\:'</span><span class="src-sym">,</span>&nbsp;<span class="src-str">&quot;:&quot;</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$match</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a155"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$params</span>&nbsp;=&nbsp;<span class="src-id">explode</span><span class="src-sym">(</span><span class="src-var">$delim</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$match</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a156"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$match</span>&nbsp;=&nbsp;<span class="src-id">array_pop</span><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a157"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a158"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$dictionary</span><span class="src-sym">[</span><span class="src-var">$match</span><span class="src-sym">]</span><span class="src-sym">))</span>&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a159"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$translations</span><span class="src-sym">[</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-id">count</span><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">)</span>><span class="src-num">0</span>&nbsp;?&nbsp;<span class="src-id">vsprintf</span><span class="src-sym">(</span><span class="src-var">$dictionary</span><span class="src-sym">[</span><span class="src-var">$match</span><span class="src-sym">]</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$params</span><span class="src-sym">)</span>&nbsp;:&nbsp;<span class="src-var">$dictionary</span><span class="src-sym">[</span><span class="src-var">$match</span><span class="src-sym">]</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a160"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$cache</span><span class="src-sym">[</span><span class="src-var">$match</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$dictionary</span><span class="src-sym">[</span><span class="src-var">$match</span><span class="src-sym">]</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a161"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a162"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else</span>&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a163"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Replace&nbsp;with&nbsp;untranslated&nbsp;string</span></span></div></li>
<li><div class="src-line"><a name="a164"></a><span class="src-str"><span class="src-comm"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$translations</span><span class="src-sym">[</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-id">count</span><span class="src-sym">(</span><span class="src-var">$params</span><span class="src-sym">)</span>><span class="src-num">0</span>&nbsp;?&nbsp;<span class="src-id">vsprintf</span><span class="src-sym">(</span><span class="src-var">$match</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$params</span><span class="src-sym">)</span>&nbsp;:&nbsp;<span class="src-var">$match</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a165"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$missing</span><span class="src-sym">[</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$match</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a166"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$cache</span><span class="src-sym">[</span><span class="src-var">$match</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$match</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a167"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a168"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a169"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$source</span>&nbsp;=&nbsp;<span class="src-id">str_replace</span><span class="src-sym">(</span><span class="src-var">$tags</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$translations</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$source</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a170"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a171"></a><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a172"></a><span class="src-str"><span class="src-sym">}</span></span></div></li>
</ol>
</span></div>
        <div class="credit">
		    <hr class="separator" />
		    Documentation generated on Tue, 04 Aug 2009 19:59:10 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>